package com.atguigu3.common_algorithm.exer2;

/**
 * @author lhl
 * @date 2025/3/31 10:27
 */
public class ArrayExer02 {
    public static void main(String[] args) {
        int[] scores = {5,4,6,8,9,0,1,2,7,3};

        int sum = 0;
        int max = scores[0];
        int min = scores[0];

        for (int i = 0; i < scores.length; i++) {
            sum = sum + scores[i];
            if (scores[i] > max) max = scores[i];
            if (scores[i] < min) min = scores[i];
        }

        int avg = (sum - max - min) / (scores.length - 2);
        System.out.println("去掉一个最高分和一个最低分后其余8位评委打分的平均值："+avg);
    }
}
